package com.taiji.workOrder.Utils;

import com.taiji.common.utils.StringUtils;
import com.taiji.workOrder.Utils.Const;

public class Const {

    public enum ProjectStatus {

        NOTSTARTED("0", "未启动"),
        DOING("1", "执行中"),
        FINISHED("2", "已完成"),
        CLOSED("3", "关闭");

        private Integer code;
        private String desc;
        private ProjectStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
        public void setDesc(String desc) {
            this.desc = desc;
        }
        public Integer getCode() {
            return code;
        }
        public void setCode(Integer code) {
            this.code = code;
        }



        ProjectStatus(String key, String value) {
            this.key = key;
            this.value = value;
        }

        private String key;
        private String value;

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public static String getKeyByValue(String val) {
            ProjectStatus[] values = values();
            for (int i = 0; i < values.length; i++) {
                if (StringUtils.equals(val, values[i].value)) {
                    return values()[i].key;
                }
            }
            return null;
        }

        public static String getValByKey(String key) {
            ProjectStatus[] values = values();
            for (int i = 0; i < values.length; i++) {
                if (StringUtils.equals(key, values[i].key)) {
                    return values()[i].value;
                }
            }
            return null;
        }
    }

    public enum WorkOrderFilesType {

        WORKORDERENCLOSURE("0", "工单附件"),
        PROCESSENCLOSURE("1", "处理过程附件");

        private Integer code;
        private String desc;
        private WorkOrderFilesType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
        public void setDesc(String desc) {
            this.desc = desc;
        }
        public Integer getCode() {
            return code;
        }
        public void setCode(Integer code) {
            this.code = code;
        }



        WorkOrderFilesType(String key, String value) {
            this.key = key;
            this.value = value;
        }

        private String key;
        private String value;

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public static String getKeyByValue(String val) {
            WorkOrderFilesType[] values = values();
            for (int i = 0; i < values.length; i++) {
                if (StringUtils.equals(val, values[i].value)) {
                    return values()[i].key;
                }
            }
            return null;
        }

        public static String getValByKey(String key) {
            WorkOrderFilesType[] values = values();
            for (int i = 0; i < values.length; i++) {
                if (StringUtils.equals(key, values[i].key)) {
                    return values()[i].value;
                }
            }
            return null;
        }
    }

    public enum WorkOrderStatus {

        CREATEWORK("-1","创建中"),
        WAITHANDLE("0", "待处理"),
        DOING("1", "处理中"),
        FINISH("2", "已完成"),
        DELAYED("3", "已延期"),
        CLOSED("4", "已关闭");

        private Integer code;
        private String desc;
        private WorkOrderStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
        public void setDesc(String desc) {
            this.desc = desc;
        }
        public Integer getCode() {
            return code;
        }
        public void setCode(Integer code) {
            this.code = code;
        }



        WorkOrderStatus(String key, String value) {
            this.key = key;
            this.value = value;
        }

        private String key;
        private String value;

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public static String getKeyByValue(String val) {
            WorkOrderStatus[] values = values();
            for (int i = 0; i < values.length; i++) {
                if (StringUtils.equals(val, values[i].value)) {
                    return values()[i].key;
                }
            }
            return null;
        }

        public static String getValByKey(String key) {
            WorkOrderStatus[] values = values();
            for (int i = 0; i < values.length; i++) {
                if (StringUtils.equals(key, values[i].key)) {
                    return values()[i].value;
                }
            }
            return null;
        }
    }

}
